Skip to content

Feature/skill self debug and systemd service#879

Open
keithy wants to merge 1 commit intosipeed:mainfrom
keithy:feature/skill_self-debug_and_systemd_service
Open

Feature/skill self debug and systemd service#879
keithy wants to merge 1 commit intosipeed:mainfrom
keithy:feature/skill_self-debug_and_systemd_service

Conversation

@keithy
Copy link

@keithy keithy commented Feb 27, 2026

📝 Description
This PR introduces essential stability and observability features for PicoClaw.
It adds a Self-Debug Skill to allow the agent to diagnose its own execution failures from logs
and a Systemd Service installer to ensure the agent runs as a persistent, background daemon.

🗣️ Type of Change
[ ] 🐞 Bug fix (non-breaking change which fixes an issue)
[x] ✨ New feature (non-breaking change which adds functionality)
[ ] 📖 Documentation update
[x] ⚡ Code refactoring (improved service management)

🤖 AI Code Generation
[x] 👨‍💻 Mostly Human-written (Human lead)

🔗 Related Issue

📚 Technical Context
Reference URL: https://github.com/keithy/picoclaw/tree/feature/skill_self-debug_and_systemd_service

🧪 Test Environment
Hardware: Rock64 (ARM64)
OS: Debian/Ubuntu (Linux) armbian, mise
Channels: CLI / Local Daemon

☑️ Checklist
[x] My code/docs follow the style of this project.
[x] I have performed a self-review of my own changes.
[x] I have updated the documentation (added systemd instructions).

@keithy
Copy link
Author

keithy commented Feb 27, 2026

Note this is supplied as a self-contained skill, so that other options can be included easily.

@keithy
Copy link
Author

keithy commented Feb 27, 2026

Advanced use-cases

Although picoclaw has built in support for multiple agents, this scheme provides the flexibility for
parallel deployments with entirely different configurations e.g.

  • Fixer - a second stable instance whose role is to be available to debug/monitor/fix the first.
  • Blue/Green Stable/Canary pairings.
  • Picoclaw farm

Personal note:
I use the fixer pattern, with the systemd.service unit installed, the default behaviour is to start and stop the service when the user logs in/out. The fixer runs under a separate user account and has sudo access to fix anything, so is under close supervison. This gives the ai a unique, in-situ position to debug and operate at a system level. For example, it helped me to compile and deploy the zfs kernel module into the rock64 on armbian.

Copy link

@nikolasdehor nikolasdehor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting and useful skill concept — self-debugging is a powerful capability. Several issues: (1) Shell injection risk: SKILL.md tools pass PICOCLAW_SERVICE_NAME directly into exec commands. If the service name contains shell metacharacters, this could be exploited. Consider validating/sanitizing the service name. (2) macOS script parity: The launchd script lacks error handling compared to systemd — uses 'which' instead of 'command -v', no check for picoclaw binary existence, missing trailing newline. (3) Log location on macOS: /tmp/service_name.log is world-readable and cleared on reboot. Consider ~/Library/Logs/. (4) SKILL.md quoting: exec picoclaw --config PICOCLAW_CONFIG status has nested double quotes that would break in shell. (5) Scope question: Is workspace/skills/ the correct location for bundled skills?

@keithy
Copy link
Author

keithy commented Feb 28, 2026

I am tidying this PR, watch this space.

@keithy
Copy link
Author

keithy commented Feb 28, 2026

Are you now explicitly blocking systemctl and journalctl ? The whole reason I am using picoclaw is to manage my infrastructure.

@keithy keithy force-pushed the feature/skill_self-debug_and_systemd_service branch from ee58508 to aa441ea Compare February 28, 2026 16:55
@keithy
Copy link
Author

keithy commented Feb 28, 2026

This PR has been reworked, all actions are implemented through a script with full parameter sanitization.
MacOS logs in ~/Library/Logs as suggested.

depends on: #896

@keithy keithy force-pushed the feature/skill_self-debug_and_systemd_service branch 5 times, most recently from edb440d to fc3c189 Compare February 28, 2026 17:34
Introduces the `self-debug` skill, a new capability designed to help users and the agent itself diagnose its own state. This provides a standardized way to inspect logs, service status, and configuration without requiring platform-specific knowledge.

This new skill includes:
- A cross-platform `debug.sh` helper script for Linux (systemd) and macOS (launchd).
- Key diagnostic actions: `logs`, `logs-errors`, `service-status`, and `config-safe`.
- Service installation scripts for both systemd and launchd to streamline setup.
- Comprehensive `SKILL.md` documentation with a clear action table and usage examples.

This feature simplifies troubleshooting and provides essential, built-in tools for maintaining agent health.
@keithy keithy force-pushed the feature/skill_self-debug_and_systemd_service branch from fc3c189 to a11816e Compare February 28, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants